package com.shop.service.impl;

import com.shop.bean.Admin;
import com.shop.dao.AdminDao;
import com.shop.dao.impl.AdminDaoImpl;
import com.shop.service.AdminService;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author:zyn
 * @Date:2025/9/19--12:57:24
 */
public class AdminServiceImpl implements AdminService {
    private AdminDao ad=new AdminDaoImpl();
    @Override
    public Map<String, Object> login(String account, String password) {
        Admin admin=ad.selectAdmin(account,password);
        Map<String,Object> loginAdmin=new HashMap<>();
        if(admin != null){
            loginAdmin.put("loginAdmin",admin);
        }else{
            admin=ad.selectAdminByAccount(account);
            if(admin != null){
                loginAdmin.put("msg","密码错误");
            }else{
                loginAdmin.put("msg","账号不存在");
            }
        }
        return loginAdmin;
    }
}
